using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SiteECSWeb;

public partial class News_NewsDetials : PageBase
{
    int NewsID;
    private int RankID;  
    protected void Page_Load(object sender, EventArgs e)
    {
        #region UtilityControls
        PrintHelper.PrintOnHyperLink(NewsHeaderServer, NewsDescServer,
           UtilityControls1.HyperLinkPrintName);
        Helper.MailUrlPath(UtilityControls1.HyperLinkMailName, this.Request);
        #endregion

        
        if (!IsPostBack)
        {
            #region SiteMap
            Helper.BuildDynamicSiteMap("News",
                Globals.Settings.VirtualNamesInfo.NewsArchive, true, "News One",
                Globals.Settings.VirtualNamesInfo.NewsDetails,
                string.Empty,
                Globals.Settings.VirtualNamesInfo.NewsEdit,
                Globals.Settings.VirtualNamesInfo.NewsReport,
                false);
            this.SiteMapNodeProvider = SiteMapProviderNames.DynamicSiteMapProvider.ToString();
            SiteMapPath1.SiteMapProvider = SiteMapNodeProvider;
            #endregion
            //base.LogActivity("helojk;ljsdf ", true);
        }
    }
    protected void NewsDataSource_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
    {
        if (Helper.CheckAndGetQueryStringInt
            ("NewsID", Globals.Settings.VirtualNamesInfo.NewsDetails, out NewsID))
        {
            e.InputParameters["News_id"] = NewsID.ToString();
        }       
    }
    protected void ReptNewsDesc_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item ||
            e.Item.ItemType == ListItemType.AlternatingItem)
        {
            EcsSiteDS.NewsRow newsrow = (EcsSiteDS.NewsRow)
                ((System.Data.DataRowView)e.Item.DataItem).Row;
            RankID = (int)newsrow.RowRank;
            NewsBLL newsAPI = new NewsBLL();
            ReptNewsPrev.DataSource = newsAPI.GetNewsByRowRank(RankID - 1);
            ReptNewsPrev.DataBind();
            ReptNewsNext.DataSource = newsAPI.GetNewsByRowRank(RankID + 1);
            ReptNewsNext.DataBind();

        }
    }
}
